package com.example.shushiyunsst.fragment

import android.content.Context
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import com.example.library_common.global.AppGlobals
import com.example.shushiyunsst.BalanceInfoWork
import com.example.shushiyunsst.MainActivity
import com.example.shushiyunsst.UserInfoDataWorker
import com.example.wallet.db.UserInfoManager
import com.umeng.message.PushAgent

const val UPDATE_TYPE_USER_LOGO = "1"

const val UPDATE_TYPE_USER_NAME = "2"

fun getUserInfo(context: Context) {
    WorkManager.getInstance(context)
        .beginWith(
            OneTimeWorkRequest.Builder(UserInfoDataWorker::class.java)
                .build()
        )
        .enqueue()
}

fun signOut() {

    UserInfoManager.userInfoManager.signOutUserInfoWrapper()
    MainActivity.entry(com.example.wallet.global.AppGlobals.getApplication())
}

fun getUserBalanceInfo(context: Context) {
    WorkManager.getInstance(context)
        .beginWith(
            OneTimeWorkRequest.Builder(BalanceInfoWork::class.java)
                .build()
        )
        .enqueue()
}